<?php
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\App;

class AuthController extends Controller {
    protected $location;

    public function __construct(){
        $this->location = $_SESSION['location'];
        App::setLocale($this->location);
    }

    public function getLogin(){
        return view('auth.login');
    }

    public function postLogin(Request $request){
        $validator = $request->validate([
            'email' => 'required|unique:posts|max:255',
            'password' => 'required',
        ]);
//        if($validator->fails()){
//            return $this->error('400013',$validator->errors()->first());
//        }
//        return $this->success([]);
    }

    public function postLogin123(Request $request){
        $validator = Validator::make($request->input(),[
            'email' => 'required|unique:posts|max:255',
            'password' => 'required',
        ]);
        if($validator->fails()){
            return $this->error('414',$validator->errors()->first());
        }
        return $this->success([]);
    }

    public function getLogout(){

    }
}

